Skip to content

Conversation

@davidwrighton
Copy link
Member

Fix a set of issues found when attempting to use the debugger on interpreted code. In general we need to get the interpreter byte codes if possible when attempting to use the EECodeInfo infrastructure. These changes helped me debug issues that appeared in interpmode=2

@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @BrzVlad, @janvorli, @kg
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes debugger issues when working with interpreted code by ensuring that the EECodeInfo infrastructure can retrieve interpreter byte codes instead of interpreter stub addresses. The key addition is a new function GetInterpreterCodeFromInterpreterPrecodeIfPresent that unwraps interpreter precodes to get the actual bytecode addresses.

Key changes:

  • New function GetInterpreterCodeFromInterpreterPrecodeIfPresent to extract interpreter bytecode addresses from interpreter precodes
  • Helper method GetCodeForInterpreterOrJitted in MethodDesc for easier access
  • Multiple DAC (Data Access Component) files updated to use the new function/helper when retrieving code addresses

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/coreclr/vm/stubmgr.cpp Adds null check for pPrecode to prevent dereferencing null pointers
src/coreclr/vm/precode.h Declares new function GetInterpreterCodeFromInterpreterPrecodeIfPresent
src/coreclr/vm/precode.cpp Implements GetInterpreterCodeFromInterpreterPrecodeIfPresent to unwrap interpreter precodes
src/coreclr/vm/method.hpp Adds GetCodeForInterpreterOrJitted helper method for MethodDesc
src/coreclr/debug/daccess/request.cpp Updates code address retrieval to use new helper/function in multiple locations
src/coreclr/debug/daccess/enummem.cpp Uses GetCodeForInterpreterOrJitted for stack trace exception handling
src/coreclr/debug/daccess/dacdbiimpl.cpp Updates GetMethodRegionInfo and GetNativeCodeInfoForAddr to use new function/helper
src/coreclr/debug/daccess/daccess.cpp Updates multiple debugger functions to use GetCodeForInterpreterOrJitted and GetInterpreterCodeFromInterpreterPrecodeIfPresent

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@jkotas jkotas merged commit 3a11eaf into dotnet:main Jan 14, 2026
100 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants